package com.iflytek.sbd.demo.lambda.ifelse;

import java.util.HashSet;
import java.util.Set;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Predicate;

/**
 * @program: sbd
 * @description: 测试多个else
 * @author: 陈亮
 * @create: 2022-03-06 20:55
 */
public class Demo {


    public static void main(String[] args) {
        String type = "1";
        consumer02(() -> type.equals("2"), s -> s.add("加油"));

    }


    private static void consumer02(BooleanSupplier condition, Consumer<Set<String>> consumer) {

        HashSet<String> set = new HashSet<>();
        if (condition.getAsBoolean()) {
            consumer.accept(set);
        }
        System.out.println(set);
    }
}
